<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
<title>获取文本框并修改其内容</title>
</head>
<body>
<script type="text/javascript">
    function c1(){
        var t=document.getElementById("txt");
        t.value="修改文本内容"
    }
</script>
<input type="text" id="txt" value="初始文本内容">
<input type="button" value="更改文本内容" name="btn" onclick="c1()">
</body>
</html>
